package com.wuge.springMybatis0807.dao;

import com.wuge.springMybatis0807.entity.SpringUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by Administrator on 2017/8/7.
 */
@CacheNamespace(size = 512)
public interface SpringUserDao {
    @Select("SELECT * FROM springuser WHERE username=#{username} AND password=#{password}")
    public SpringUser getUser(String username, String password);
    @Select("select * from springuser")
    public List<SpringUser> getAllUsers();
    @Select("insert into springuser set username =#{username}, password=#{password} ")
    public Integer addUser(SpringUser user);
    @Update("update springuser set username = #{username}, password= #{password} ")
    public int updateUser(SpringUser user);
    @Delete("delete from springuser where id = #{userId}")
    public int deleteUser(int userId);
}
